FIND_PACKAGE(Doxygen)  

IF(DOXYGEN_FOUND)   
SET(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)  
SET(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)  

CONFIGURE_FILE(${doxyfile_in} ${doxyfile} @ONLY)  

ADD_CUSTOM_TARGET(doc  
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}  
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}  
COMMENT "Generating API documentation with Doxygen"  
VERBATIM)  

INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DESTINATION share/fuxi)  
ENDIF()  
